///////////////////////////////////////////////////////////////////////////////////////////////////
// Illusion Ray Development Kit (IDK)           Copyright (c) 2010 ( dimitriy.martynenko@gmail.com )
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2010-05-22
// Updated : ...
// Licence : NEW BSD
// Info	   : IDK Engine
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once

namespace Core
{
	/*-------------------------------------------------------------------------
	| BasicCamera:
	| ------------
	| BasicCamera
	---------------------------------------------------------------------------*/
	class TCore : public Threading::TNonThread, virtual public IDK::ICore
	{
		typedef Threading::TNonThread Base;
		IDKClass;
	public:
		TCore();
	public:
		virtual void OnInit(void);
		virtual void OnStart(void);
		virtual void OnFinish(void);
		virtual void OnUpdate(float dt);
		virtual void OnActive(bool active);
		virtual void Lock(bool reset);
		virtual void Unlock(void);
	public:
		virtual void							SetDefaultResourcePath(const String& path);
		virtual ref<IDK::IMesh>					GetMesh(const String& path);
		virtual ref<IDK::IMaterial>				GetMaterial(const String& name);
		virtual ref<IDK::ITexture>				AddTexture(const String& path, IDK::Pixel::Type::Enum pixelType, uint mipCount, uint width, uint height);
		virtual ref<IDK::IShader>		GetShader(const String& path);
		virtual ref<IDK::IRenderTarget>			GetRenderTarget(const String& name);
		virtual ref<IDK::IRenderTexture>		CreateRenderTexture(uint width, uint height, IDK::Pixel::Type::Enum pixelType);
		virtual void							Clear(void);
		virtual	IDK::Stream						GetStream(String path);
	public:
		virtual void OnThreadStart(void);
		virtual void OnThreadStop(void);
		virtual bool OnThreadUpdate(float dt, bool ready);
		virtual void ReadyForProcessing(void);
	private:
		ResourceManager mResMananager;
		//
		Array<Mesh> mMeshes;
		Array<Material> mMaterials;
		Array<Texture> mTextures;
		//helper
		String mDefaultResourcePath;
	};

	typedef ref<TCore> Core;
}